//
//  FirmwareFileApi.m
//  CoolTennisBall
//
//  Created by CA on 16/4/11.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "FirmwareFileApi.h"

@interface FirmwareFileApi ()
@property (nonatomic, copy) NSString *downloadFilePath;
@end

@implementation FirmwareFileApi

- (instancetype)initWithDownloadPath:(NSString *)downloadPath
{
    self = [super init];
    if (self) {
        _downloadFilePath = downloadPath;
    }
    return self;
}

-(NSString *)requestUrl
{
    return self.downloadFilePath;
}

-(YTKRequestMethod)requestMethod
{
    return YTKRequestMethodPOST;
}

- (BOOL)useCDN {
    return YES;
}

- (NSString *)resumableDownloadPath {
    NSString *libPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSString *cachePath = [libPath stringByAppendingPathComponent:@"Caches"];
    NSString *filePath = [cachePath stringByAppendingPathComponent:self.downloadFilePath.lastPathComponent];
    return filePath;
}


@end
